#include<iostream>
using namespace std;
int father[1010];
int Find(int n)
{
	int t = n;
	while (t != father[t])
	{
		t = father[t];
	}
	return t;
}
int Union(int x, int y)
{
	int A = Find(x);
	int B = Find(y);
	if (A != B)
	{
		father[A] = B;
	}
}
